package com.rental.web.service.impl;

import com.rental.common.result.AjaxResult;
import com.rental.client.CosFeignClient;
import com.rental.model.vo.CosUploadVo;
import com.rental.web.service.CosService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

@Service
public class CosServiceImpl implements CosService {

    @Autowired
    private CosFeignClient cosFeignClient;
    @Override
    public AjaxResult<String> upload(MultipartFile file, String path) {
        CosUploadVo cosUploadVo = cosFeignClient.upload(file, path).getData();
        if (cosUploadVo != null) {
            return AjaxResult.success(cosUploadVo.getShowUrl());
        }
        return null;
    }
}
